package com.eip.zd.controller;

import com.eip.zd.common.Result;
import com.eip.zd.entity.Standard;
import com.eip.zd.service.StandardService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/standard")
public class StandardController {
    @Resource
    private StandardService standardService;

    @GetMapping("/getStandardList")
    public Result getStandardList() {
        List<Standard> standardList = standardService.getStandardList();
        return Result.success(standardList);
    }
    @GetMapping("/getCustStandard/{custId}")
    public Result getCustStandard(@PathVariable String custId) {
        List<Standard> standardList = standardService.getCustStandard(custId);
        return Result.success(standardList);
    }
    @PostMapping("/add")
    public Result addStandard(@RequestBody Standard standard) {
        standardService.add(standard);
        return Result.success();
    }
    @PostMapping("/update")
    public Result updateStandard(@RequestBody Standard standard) {
        standardService.update(standard);
        return Result.success();
    }
    @PostMapping("/remove/{id}")
    public Result removeStandard(@PathVariable Long id) {
        standardService.remove(id);
        return Result.success();
    }
}
